/*
 * thread.h
 *
 *  Created on: 1-nov-2012
 *      Author: dna
 */

#ifndef THREAD_H_
#define THREAD_H_

#define _GNU_SOURCE
#include "pthread.h"
#include "sched.h"
#include "utmpx.h"
#include "pthread.h"

#include "stdlib.h"
#include "time.h"
#include "stdio.h"
#include "unistd.h"
#include "sys/time.h"
#include "sys/syscall.h"


/*
 * Struct used to pass some parameters to the routine
 */
typedef struct {
	struct timeval start;	// start time
	struct timeval end;		// end time
	double time;
	long int cpu;			// on wich CPU should work this thread
	long int cpu_working;	// on wich CPU this thread is working
	int policy;
	struct sched_param priority;
	char *values;
	int values_num;
	int tid;				// thread system id
	int cid;				// thread creation id
	char cpu_bound;			// 0 CPU-bound - 1 I/O
	// ...
} routine_param;

// Ze barrier
extern pthread_barrier_t barrier;

/*
 * Thread routine
 */
void *routine(void *arg);

/*
 * Thread routine with I/O
 */
void *routineIO(void *arg);

#endif /* THREAD_H_ */
